package com.ndp.fb.scheduler.job.business;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ndp.fb.constant.ConfigConst;
import com.ndp.fb.mongo.api.IMongodbService;
import com.ndp.fb.mq.api.service.schedulerservice.AdImageSchedulerService;
import com.ndp.fb.scheduler.annotation.CronScheduled;

@Component
public class SyncBusinessDataToMongoJob {
    private static Logger logger = LoggerFactory.getLogger(SyncBusinessDataToMongoJob.class);
    @Reference
    AdImageSchedulerService adImageSchedulerService;
    @Reference
    IMongodbService mongodbService;
    /**
     * 补全图片素材
     */
    @CronScheduled(cronkey = ConfigConst.SYNC_BUSINESS_ADIMAGE_CRON, enablekey = ConfigConst.SYNC_BUSINESS_ADIMAGE_ENABLE)
    public void syncAdImage() {
        logger.info("同步账号下所有的adimage");
        adImageSchedulerService.syncAdImage();
    }
    /**
     * 补全图片素材
     */
    @CronScheduled(cronkey = ConfigConst.GET_IMAGE_MD5_CRON, enablekey = ConfigConst.GET_IMAGE_MD5_ENABLE)
    public void findImageMd5() {
        logger.info("计算所有图片的md5");
        adImageSchedulerService.findImageMd5();
    }
}
